<?php
	namespace Admin\Model;
	class UserModel extends  \Think\Model{
		public function getAll($limit=''){
			//这里获取所有的数据
			$list =$this->limit($limit)->select();
			foreach($list as $key=>$val){
				$list[$key]['sex']=$val['sex']?'男':'女';
			}
			return $list;
		}

		public function likeGet($where,$limit){
			$list=$this->where($where)->limit($limit)->select();
			foreach($list as $key=>$val){
				$userlist[$key]['sex']=$val['sex']?'男':'女';
				}
			return $list;
		}
		public function  getFind($data){
			$where='';
			//处理data
			foreach ($data as $key => $val) {
				$where.="`$key`='$val' AND ";
			}
			$where=trim($where,'AND');
			$res=$this->where("$where")->find();
			if($res==null){
				return false;

			}else{
				return $res;
			}
		}
		public function change($status,$id){
			$data['status']=!$status;

			$this->where("id=$id")->save($data);
		}
		public function deleted($id){
			$res=$this->where("id=$id")->delete();
			return $res;
		}
		
	}